package model;

import java.util.Calendar;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.OneToMany;

@Entity
public class Locacao {
	
	private Long id;
	private Calendar dataLocacao;
	private Calendar dataEntrega;
	private Long multa;	
	private Collection<Locavel> listaLocaveis;
	
	@Column(name="locacao_id")
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	public Calendar getDataLocacao() {
		return dataLocacao;
	}
	
	public void setDataLocacao(Calendar dataLocacao) {
		this.dataLocacao = dataLocacao;
	}
	
	public Calendar getDataEntrega() {
		return dataEntrega;
	}
	
	public void setDataEntrega(Calendar dataEntrega) {
		this.dataEntrega = dataEntrega;
	}
	
	public Long getMulta() {
		return multa;
	}
	
	public void setMulta(Long multa) {
		this.multa = multa;
	}

	@OneToMany
	@JoinTable(name="locacao_locavel", 
	joinColumns=@JoinColumn(name="locacao_id"), 
	inverseJoinColumns=@JoinColumn(name="locavel_id"))
	public Collection<Locavel> getListaLocaveis() {
		return listaLocaveis;
	}

	public void setListaLocaveis(Collection<Locavel> listaLocaveis) {
		this.listaLocaveis = listaLocaveis;
	}

}
